<template>
	<div class="panel-header">
		<div class="inner">
			<img src="@/assets/images/home/logo.jpg">
			<div class="title">{{title}}</div>
			<div class="is-login" v-if="form && form == 'register'">
				<div v-if="isLogin" @click="outLogin">
					<a>退出登录</a>
				</div>
				<div v-else>
					已有账号？ <a @click="routeToPath('/login?staffId='+staffId)">立即登录</a>
				</div>
			</div>
			<el-button v-else-if="form == 'agreement'" class="da-fr back" @click="routeToPath('')">
				返回上一页
			</el-button>
			</div>
		</div>
	</div>
</template>
<script>
import { removeToken, removeAuthUserInfo } from '@/utils/auth'
export default {
  name: 'ForgetHeader',
  props: {
  	title:{
	  	type: String,
	  	default: '更换手机'
  	},
		form: {
			type: String,
			default: '',
		}
  },
  data() {
    return{
			isLogin: false,
			staffId: this.getUrlParams('staffId'),
    }
  },
	created() {
		if(this.getUserInfo().userId && this.getUserInfo().userId != "undefined"){
			this.isLogin = true;
		}else{
			this.isLogin = false;
		}
	},
	methods: {
		outLogin() {
			removeToken();
			removeAuthUserInfo();
			this.routeToPath('/login')
		}
	}
}
</script>
<style lang="scss" scoped>
	.panel-header{
		background-color: #fff;
	    height: 73px;
	    width: 100%;
	    border-bottom: 1px solid #ddd;
	    .inner{
	    	width: 900px;
	    	margin: auto;
	    }
	    img{
	    	display: inline-block;
	    	vertical-align: middle;
	    	margin: 14px 0 0;
	    }
	    .title{
	    	display: inline-block;
	    	vertical-align: top;
	    	border-left: 1px solid #E6DDD4;
	    	height: 18px;
	    	font-size: 16px;
	    	margin: 28px 8px;
	    	padding-left: 10px;
	    }
			.is-login{
				float: right;
				line-height: 70px;
			}
	}
	.back{
		float: right;
		margin-top: 16px;
	}
</style>
